<template>
  <div>
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>文档管理</span>
      </div>
      <el-table style="width: 100%" :data="tableData">
          <el-table-column type="index" align="center"></el-table-column>
          <el-table-column prop="taskName" label="任务名称" align="center"></el-table-column>
          <el-table-column prop="stageName" label="所属项目阶段" align="center"></el-table-column>
          <el-table-column prop="docName" label="文档名称" align="center"></el-table-column>
          <el-table-column prop="createTime" label="上传时间" align="center"></el-table-column>
          <el-table-column prop="creator" label="上传用户" align="center"></el-table-column>
          <el-table-column label="操作" align="center">
              <template slot-scope="scope">
                  <el-button size="mini" type="success">
                    <a :href="scope.row.url" :download="scope.row.docName" class="download">下载</a>
                  </el-button>
              </template>
          </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>
<script>
export default {
    name: 'document',
    data() {
        return {
            tableData: []
        }
    },
    methods: {
      getDocument() {
        let params = {
          projectId: this.$route.query.id
        };
        this.$store.dispatch('project/getDocument', params).then(res => {
          this.tableData = res.records; 
        })
      } 
    },
    mounted() {
      this.getDocument();
    }
};
</script>
<style lang="less" scoped>
a {
  color: #fff;
  text-decoration: none;
}
</style>